package com.wondersgroup.fjzlpt.yyzyzx.dao.impl.yyzygl.yysz;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import com.alibaba.fastjson.JSONArray;
import com.quick.framework.boot.repository.sql.bean.SQLBean;
import com.quick.framework.boot.repository.sql.bean.table.TableBean;
import com.quick.framework.boot.repository.sql.jdbcTemplate.impl.BaseJTDAOImpl;
import com.wondersgroup.fjzlpt.yyzyzx.dao.inter.yyzygl.yysz.CwyyfsyxjDao;

@Repository
public class CwyyfsyxjDaoImpl extends BaseJTDAOImpl implements CwyyfsyxjDao{

	@Override
	@Autowired
	@Qualifier("TB_YYZY_CWYYFSYXJ")
	public void setTb(TableBean tb) {
		super.setTb(tb);
	}

	/**
	 * 通过"床位设置编码"删除所有相关记录
	 * @param CWSZBH
	 */
	@Override
	public void deleteByCwszbm(String CWSZBH) {
		StringBuffer sqlBuf = new StringBuffer("delete from ").append(this.tb.getTableName()).append(" where CWSZBH = ?");
		SQLBean delBean = new SQLBean(sqlBuf.toString(), CWSZBH);
		
		super.update(delBean);
	}

	/**
	 * 根据"床位设置编码"查询所有相关记录
	 * @param map
	 * @return
	 */
	@Override
	public JSONArray queryByCwszbh(String CWSZBH) {
		StringBuffer sqlBuf = new StringBuffer("select * from ").append(this.tb.getTableName())
				.append(" where CWSZBH = ? order by XH");
		SQLBean bean = new SQLBean(sqlBuf.toString(), CWSZBH);
		return super.queryList(bean);
	}
}
